uniform extern texture base_Tex;
sampler2D baseMap = sampler_state
{
   Texture = (base_Tex);
};
float gamma;
struct PS_INPUT 
{
   float2 Texcoord : TEXCOORD0;
};
float4 Pixel_Shader_ps_main( PS_INPUT Input ) : COLOR0
{
   float g = 1/gamma;
   float4 old_value = float4(0.0f,0.0f,0.0f,0.0f);
   float4 new_value = float4(0.0f,0.0f,0.0f,0.0f);
   old_value = tex2D( baseMap, Input.Texcoord );
   new_value.x = min(1, pow( old_value.x, g ));
   new_value.y = min(1, pow( old_value.y, g ));
   new_value.z = min(1, pow( old_value.z, g ));
   new_value.w = min(1, pow( old_value.w, g ));
   float4 Output = float4(new_value.x, new_value.y, new_value.z, new_value.w);
   return Output; 
}
technique GammaCorrection
{
   pass Pass_0
   {
      PixelShader = compile ps_2_0 Pixel_Shader_ps_main();
   }
}

